#
from docx import Document
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
from docx.shared import Inches
from docx.shared import Pt

document = Document()
paragraph1 = document.add_paragraph("这是第一个段落")
paragraph2 = document.add_paragraph("这是第二个段落")
# paragraph_format = paragraph.paragraph_format
# print(paragraph_format.left_indent)
#
# paragraph_format.left_indent = Inches(0.5)
# print(paragraph_format.left_indent.inches)
#
# paragraph.add_run('段落缩进演示1')
# paragraph.add_run('段落缩进演示2')
#
# document.save('段落缩进.docx')

# 段落间距
paragraph1.paragraph_format.space_before = Pt(24)
paragraph1.paragraph_format.space_after = Pt(12)

paragraph2.paragraph_format.space_before = Pt(30)
paragraph2.paragraph_format.space_after = Pt(10)

document.save('修改段落间距.docx')
